package com.ddc.drivers.fmpxml;

/**
 * Represents a field assignment in an UPDATE or INSERT query, where a field is being assigned a value.
 */
public class AssignmentTerm {
	private FmField field;
	private Object value;
	private boolean isPlaceholder;

	public AssignmentTerm(FmField field, Object value, boolean placeholder) {
		if ("null".equalsIgnoreCase(String.valueOf(value))) value = null;
		this.field = field;
		this.value = value;
		isPlaceholder = placeholder;
	}

	/** The field being set. */
	public FmField getField() {
		return field;
	}

	/** The value the field is being set to. */
	public Object getValue() {
		return value;
	}

	/**
	 * Whether the assignment uses a placeholder '?' in a prepared statement.
	 */
	public boolean isPlaceholder() {
		return isPlaceholder;
	}

}